local ahkautover = 32
local dir = "luachip/"

local temp = {}
if luachip then
	temp.kbs = luachip.kbs
end
luachip = {}
luachip.kbs = temp.kbs
luachip.dir = dir
luachip.version = ahkautover

luachipgc_CheckKillCode = function()
	//This makes sure that our current version doesn't have a potential, compromising backdoor
	//Not like that could ever happen
	local kc = tonumber(luachipgc_killcode)
	
	if not kc then
		return false
	end
	
	if kc > tonumber(luachip.version) then
		return true
	end
	return false
end

if SERVER then
	AddCSLuaFile(dir.."cl_luachip.lua")
	AddCSLuaFile(dir.."sh_code.lua")
	AddCSLuaFile(dir.."sh_code_lists.lua")
	AddCSLuaFile(dir.."sh_code_helper.lua")
	AddCSLuaFile(dir.."sh_code_library.lua")
	AddCSLuaFile(dir.."sh_luachip.lua")
	AddCSLuaFile(dir.."cl_transfer.lua")
	
	include(dir.."sv_propprotecthook.lua")
	include(dir.."sh_code.lua")
	include(dir.."sh_code_lists.lua")
	include(dir.."sh_code_helper.lua")
	include(dir.."sh_code_library.lua")
	include(dir.."sh_luachip.lua")
	include(dir.."sv_luachip.lua")
	include(dir.."sv_transfer.lua")
	include(dir.."sv_ent_implementation.lua")
	
	if SinglePlayer() and player.GetByID(1) and IsEntity(player.GetByID(1)) and player.GetByID(1):IsPlayer() then //For easy reloading
		player.GetByID(1):SendLua('_G["include"]("'..dir..'luachip.lua")')
	end
	
	hook.Add("Initialize","LuaChipSendRes",function()
		resource.AddFile("resource/fonts/LiberationMono-Bold.ttf")
		resource.AddFile("settings/render_targets/LuaChipScreen.txt")
	end)
end

if CLIENT then
	include(dir.."sh_code.lua")
	include(dir.."sh_code_lists.lua")
	include(dir.."sh_code_helper.lua")
	include(dir.."sh_code_library.lua")
	include(dir.."sh_luachip.lua")
	include(dir.."cl_luachip.lua")
	include(dir.."cl_transfer.lua")
end

luachip.Initialize()
